package org.codeart.springdemo.publisher;

import org.codeart.springdemo.event.RequestEvent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;

@Component
public class RequestPublisher {
    
    @Autowired
    private ApplicationContext context;

    public void doRequest() {
        System.out.println("调用 RequestPublisher 发布了一个事件");
        context.publishEvent(new RequestEvent(this));
    }
}
